﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    public static class MyWeb
    {  

        #region 缓存数据
        /// <summary>
        /// 缓存数据
        /// </summary>
        /// <param name="data">数据</param>
        /// <param name="cachekey">缓存键值</param>
        /// <param name="CacheMinutes">缓存时间,单位分</param>
        /// <returns></returns>
        public static object GetByCache(object data,string cachekey,int CacheMinutes)
        {
            object objModel = Common.DataCache.GetCache(cachekey);
            if (objModel == null)
            {
                try
                {
                    objModel = data;
                    if (objModel != null)
                    {
                        Common.DataCache.SetCache(cachekey, objModel, DateTime.Now.AddMinutes(CacheMinutes), TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return objModel;
        }
        #endregion


    }
}
